package com.boot.mailForCommon;


import com.boot.mailForCommon.core.MailSender;
import com.boot.mailForCommon.enums.MailContentTypeEnum;
import com.boot.mailForCommon.utils.MutiPartUtil;

import javax.mail.internet.MimeBodyPart;
import java.util.ArrayList;

public class TestMail {
    public static void main(String[] args) throws Exception {
        String[][] images = {{"D:/1.jpg", "my_image"}, {"D:/学生统计.xlsx", "my_img"}, {"D:/resourses/video/springboot/01.mp4", "my_v"}};
        String a = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body>这是一封超文本邮件<br />html标签有效<img src='cid:my_image' /><img src='cid:my_img' /><img src='https://www.java.com/feo-cdn/r/_/YWcerH870.jpg' /><video src='cid:my_v' controls='controls'></body></html>";
        MimeBodyPart file = MutiPartUtil.getPart("D:/1.jpg", "图片1");
        MimeBodyPart file1 = MutiPartUtil.getPart("D:/学生统计.xlsx", "my_img");
        MimeBodyPart file2 = MutiPartUtil.getPart("D:/resourses/video/springboot/01.mp4", "my_v");
        new MailSender()
                .title("测试SpringBoot发送邮件")
                .encording("UTF-8")
                .content("resources/static/1.jpg")
                .contentType(MailContentTypeEnum.HTML)
//                .mimeBodyPartList(file,file1)
                .mimeBodyPartList(MutiPartUtil.getPart(a),file,file1,file2)
                .targets(new ArrayList<String>() {{
                    add("819546823@qq.com");
                }})
                .send();
    }
}
